package annotation;

import org.junit.Test;
import sun.invoke.empty.Empty;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class test {
    @Test
    public void parseAnnotation() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException {
        Class cls = Class.forName("annotation.use");

        boolean isExist = cls.isAnnotationPresent(Desc.class);
        if (isExist) {
            Desc annotation = (Desc) cls.getAnnotation(Desc.class);
            System.out.println("get the class annotation：" + annotation.desc());

            //@todo 获取方法的注解
        }

    }
}
